/*********************
 * 登记题目类型说明
 * *******************
 * 1: 单选
 * 2: 多选
 * 3: 单行文本
 * 4: 多行文本
 * 5: 下拉菜单
 * 6: 文件
 * 7: 表格
 A demo is showed below
 *********************/

/***********************
 {
   "problems": [
     {
       "type": 3,
       "title": "参赛队伍名字",
       "tip": "如果没有需要，则不填",
       "options": []
     },{
       "type": 1,
       "title": "你以哪种方式就业",
       "options": [
         "签三方",
         "签offer",
         "其他"
       ]
     },{
       "type": 7,
       "title": "你以哪种方式就业",
       "options": [
         1,
         4,
         "信息",
         "姓名",
         "联系电话",
         "邮箱",
         "年级"
       ]
     }
   ]
 }
 *********************/

var mongoose = require('mongoose')
var Schema = mongoose.Schema
var RegistrySchemaConfig = {
  versionKey: false,
  timestamps: {
    createdAt: 'created_at',
    updatedAt: false
  },
  typeKey: '$type'
}

var RegistrySchema = new Schema({
  team: {$type: Schema.Types.ObjectId, ref: 'Team'},
  title: String,
  summary: String,
  problems: [{
    type: {$type: Number, default: 3},
    tip: {$type: String, default: ''},
    title: String,
    require: {$type: Boolean, default: false},
    options: [Schema.Types.Mixed]
  }]
}, RegistrySchemaConfig)

exports = module.exports = RegistrySchema
